const Router = require("koa-router");

const { auth } = require("../middleware/auth.middleware");
const {
  sendArticle,
  getArticle,
  getArticleDetail,
  collectArticle,
  noCollectArticle,
  myArticle,
  collectArticleList,
  getHotArticle,
  deleteArticle
} = require("../controller/article.controller");
const {} = require("../middleware/article.middleware");
const router = new Router({ prefix: "/article" });
// 创建文章
router.post("/sendArticle", auth, sendArticle);
// 获得文章 分页 
router.get("/getArticle", getArticle);
// 获取某一篇文章的详情
router.get("/getArticleDetail", auth, getArticleDetail);
// 收藏
router.post("/collectArticle", auth, collectArticle);
// 取消收藏
router.post("/noCollectArticle", auth, noCollectArticle);
// 获得用户自己发布的文章列表
router.post("/myArticle", auth, myArticle);
// 收藏文章列表
router.post("/getCollectArticle", auth, collectArticleList);
// 热门文章 根据浏览量排序
router.post("/getHotArticle", getHotArticle);
// 删除用户自己发布的文章
router.post("/deleteArticle",auth, deleteArticle);
module.exports = router;
